package cn.as142.controller;

import cn.as142.pojo.Teacher;
import cn.as142.pojo.Users;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class HelloController {

   /* @Value("${server.port}")//通过@Value读取{从配置文件内读取的值}
    private String uname1;
    @Value("${uname}")//通过@Value读取{从配置文件内读取的值}
    private String uname;
    @Value("${user.username}")
    private String username;
    @Value("${user.password}")
    private String password;

    @Resource
    private Users users;*/

    @Resource//从spring的ioc容器获取对象
    private Teacher teacher;

    @RequestMapping("/hello")
    @ResponseBody
    public String hello() {
        //return "hello bdqn   "+uname1+"----"+uname+"----"+username+"----"+password;
        //return "hello bdqn   "+users;
        return "hello bdqn   "+teacher.getTeacherNaame();
    }
}
